

<!DOCTYPE html>
<html lang="zh-CN" data-default-color-scheme=auto>



<head>
  <meta charset="UTF-8">
  <link rel="apple-touch-icon" sizes="76x76" href="https://ikkiss.oss-cn-hangzhou.aliyuncs.com/images/myblog/IKKIS_LOGO.png">
  <link rel="icon" href="https://ikkiss.oss-cn-hangzhou.aliyuncs.com/images/myblog/IKKIS_LOGO.png">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0, shrink-to-fit=no">
  <meta http-equiv="x-ua-compatible" content="ie=edge">
  
  <meta name="theme-color" content="#2f4154">
  <meta name="author" content="Ikki">
  <meta name="keywords" content="">
  
    <meta name="description" content="1.npm私有库的理由 npm私有库只针对公司内部局域网开放，不对外部公开，具有一定的保密性 速度比在直接在npm下载更快，甚至是比淘宝源更快。因为毕竟是在公司局域网 对于发布和下载npm包配置权限管理 私有库能够将包资源进行缓存，响应的话会加快下载速度 搭建npm私有库算作对团队的一个技术亮点  1.1 选择verdaccio的理由 verdaccio是nodejs 创建的轻量的私有npm pr">
<meta property="og:type" content="article">
<meta property="og:title" content="npm私有库">
<meta property="og:url" content="http://81.68.132.127/2022/09/22/npm/npm%E7%A7%81%E6%9C%89%E5%BA%93/index.html">
<meta property="og:site_name" content="IKKI">
<meta property="og:description" content="1.npm私有库的理由 npm私有库只针对公司内部局域网开放，不对外部公开，具有一定的保密性 速度比在直接在npm下载更快，甚至是比淘宝源更快。因为毕竟是在公司局域网 对于发布和下载npm包配置权限管理 私有库能够将包资源进行缓存，响应的话会加快下载速度 搭建npm私有库算作对团队的一个技术亮点  1.1 选择verdaccio的理由 verdaccio是nodejs 创建的轻量的私有npm pr">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://ikkiss.oss-cn-hangzhou.aliyuncs.com/images/myblog/beijing/iTab-3zmr6y.jpeg">
<meta property="article:published_time" content="2022-09-22T09:56:03.000Z">
<meta property="article:modified_time" content="2022-10-07T12:05:18.175Z">
<meta property="article:author" content="Ikki">
<meta property="article:tag" content="前端工程化">
<meta property="article:tag" content="npm">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:image" content="https://ikkiss.oss-cn-hangzhou.aliyuncs.com/images/myblog/beijing/iTab-3zmr6y.jpeg">
  
  
    <meta name="referrer" content="no-referrer-when-downgrade">
  
  
  <title>npm私有库 - IKKI</title>

  <link  rel="stylesheet" href="https://lib.baomitu.com/twitter-bootstrap/4.6.1/css/bootstrap.min.css" />



  <link  rel="stylesheet" href="https://lib.baomitu.com/github-markdown-css/4.0.0/github-markdown.min.css" />

  <link  rel="stylesheet" href="https://lib.baomitu.com/hint.css/2.7.0/hint.min.css" />

  <link  rel="stylesheet" href="https://lib.baomitu.com/fancybox/3.5.7/jquery.fancybox.min.css" />



<!-- 主题依赖的图标库，不要自行修改 -->
<!-- Do not modify the link that theme dependent icons -->

<link rel="stylesheet" href="//at.alicdn.com/t/font_1749284_hj8rtnfg7um.css">



<link rel="stylesheet" href="//at.alicdn.com/t/font_1736178_lbnruvf0jn.css">


<link  rel="stylesheet" href="/css/main.css" />


  <link id="highlight-css" rel="stylesheet" href="/css/highlight.css" />
  
    <link id="highlight-css-dark" rel="stylesheet" href="/css/highlight-dark.css" />
  



  
<link rel="stylesheet" href="/fluid/css/fluid-extention.css">
<link rel="stylesheet" href="/fluid/css/nihao.css">



  <script id="fluid-configs">
    var Fluid = window.Fluid || {};
    Fluid.ctx = Object.assign({}, Fluid.ctx)
    var CONFIG = {"hostname":"81.68.132.127","root":"/","version":"1.9.3","typing":{"enable":true,"typeSpeed":70,"cursorChar":"_","loop":false,"scope":[]},"anchorjs":{"enable":true,"element":"h1,h2,h3,h4,h5,h6","placement":"left","visible":"hover","icon":""},"progressbar":{"enable":true,"height_px":3,"color":"#29d","options":{"showSpinner":false,"trickleSpeed":100}},"code_language":{"enable":true,"default":"TEXT"},"copy_btn":true,"image_caption":{"enable":true},"image_zoom":{"enable":true,"img_url_replace":["",""]},"toc":{"enable":true,"placement":"left","headingSelector":"h1,h2,h3,h4,h5,h6","collapseDepth":3},"lazyload":{"enable":true,"loading_img":"https://ikkiss.oss-cn-hangzhou.aliyuncs.com/images/myblog/loading.gif","onlypost":false,"offset_factor":2},"web_analytics":{"enable":false,"follow_dnt":true,"baidu":null,"google":null,"gtag":null,"tencent":{"sid":null,"cid":null},"woyaola":null,"cnzz":null,"leancloud":{"app_id":null,"app_key":null,"server_url":null,"path":"window.location.pathname","ignore_local":false}},"search_path":"/local-search.xml"};

    if (CONFIG.web_analytics.follow_dnt) {
      var dntVal = navigator.doNotTrack || window.doNotTrack || navigator.msDoNotTrack;
      Fluid.ctx.dnt = dntVal && (dntVal.startsWith('1') || dntVal.startsWith('yes') || dntVal.startsWith('on'));
    }
  </script>
  <script  src="/js/utils.js" ></script>
  <script  src="/js/color-schema.js" ></script>
  


  
<meta name="generator" content="Hexo 5.4.2"></head>


<body>
  

  <header>
    

<div class="header-inner" style="height: 100vh;">
  <nav id="navbar" class="navbar fixed-top  navbar-expand-lg navbar-dark scrolling-navbar">
  <div class="container">
    <a class="navbar-brand" href="/">
      <strong>Ikki-BUG制造者</strong>
    </a>

    <button id="navbar-toggler-btn" class="navbar-toggler" type="button" data-toggle="collapse"
            data-target="#navbarSupportedContent"
            aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <div class="animated-icon"><span></span><span></span><span></span></div>
    </button>

    <!-- Collapsible content -->
    <div class="collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav ml-auto text-center">
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/">
                <i class="iconfont icon-home-fill"></i>
                首页
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/archives/">
                <i class="iconfont icon-archive-fill"></i>
                归档
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/categories/">
                <i class="iconfont icon-category-fill"></i>
                分类
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/tags/">
                <i class="iconfont icon-tags-fill"></i>
                标签
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/about/">
                <i class="iconfont icon-user-fill"></i>
                关于
              </a>
            </li>
          
        
        
          <li class="nav-item" id="search-btn">
            <a class="nav-link" target="_self" href="javascript:;" data-toggle="modal" data-target="#modalSearch" aria-label="Search">
              &nbsp;<i class="iconfont icon-search"></i>&nbsp;
            </a>
          </li>
          
        
        
          <li class="nav-item" id="color-toggle-btn">
            <a class="nav-link" target="_self" href="javascript:;" aria-label="Color Toggle">&nbsp;<i
                class="iconfont icon-dark" id="color-toggle-icon"></i>&nbsp;</a>
          </li>
        
      </ul>
    </div>
  </div>
</nav>

  

<div id="banner" class="banner" parallax=true
     style="background: url('http://image.ikki0603.cn') no-repeat center center; background-size: cover;">
  <div class="full-bg-img">
    <div class="mask flex-center" style="background-color: rgba(0, 0, 0, 0.3)">
      <div class="banner-text text-center fade-in-up">
        <div class="h2">
          
            <span id="subtitle" data-typed-text="npm私有库"></span>
          
        </div>

        
          
  <div class="mt-3">
    
    
      <span class="post-meta">
        <i class="iconfont icon-date-fill" aria-hidden="true"></i>
        <time datetime="2022-09-22 17:56" pubdate>
          2022年9月22日 下午
        </time>
      </span>
    
  </div>

  <div class="mt-1">
    
      <span class="post-meta mr-2">
        <i class="iconfont icon-chart"></i>
        
          7k 字
        
      </span>
    

    
      <span class="post-meta mr-2">
        <i class="iconfont icon-clock-fill"></i>
        
        
        
          59 分钟
        
      </span>
    

    
    
      
        <span id="busuanzi_container_page_pv" style="display: none">
          <i class="iconfont icon-eye" aria-hidden="true"></i>
          <span id="busuanzi_value_page_pv"></span> 次
        </span>
        
      
    
  </div>


        
      </div>

      
        <div class="scroll-down-bar">
          <i class="iconfont icon-arrowdown"></i>
        </div>
      
    </div>
  </div>
</div>

</div>

  </header>

  <main>
    
      

<div class="container-fluid nopadding-x">
  <div class="row nomargin-x">
    <div class="side-col d-none d-lg-block col-lg-2">
      
  <aside class="sidebar" style="padding-left: 2rem; margin-right: -1rem">
    <div id="toc">
  <p class="toc-header"><i class="iconfont icon-list"></i>&nbsp;目录</p>
  <div class="toc-body" id="toc-body"></div>
</div>



  </aside>


    </div>

    <div class="col-lg-8 nopadding-x-md">
      <div class="container nopadding-x-md" id="board-ctn">
        <div id="board">
          <article class="post-content mx-auto">
            <!-- SEO header -->
            <h1 style="display: none">npm私有库</h1>
            
              <p class="note note-info">
                
                  
                    本文最后更新于：2022年10月7日 晚上
                  
                
              </p>
            
            
              <div class="markdown-body">
                
                <h1 id="1-npm私有库的理由"><a href="#1-npm私有库的理由" class="headerlink" title="1.npm私有库的理由"></a>1.npm私有库的理由</h1><ul>
<li>npm私有库只针对公司内部局域网开放，不对外部公开，具有一定的保密性</li>
<li>速度比在直接在npm下载更快，甚至是比淘宝源更快。因为毕竟是在公司局域网</li>
<li>对于发布和下载npm包配置权限管理</li>
<li>私有库能够将包资源进行缓存，响应的话会加快下载速度</li>
<li>搭建npm私有库算作对团队的一个技术亮点</li>
</ul>
<h2 id="1-1-选择verdaccio的理由"><a href="#1-1-选择verdaccio的理由" class="headerlink" title="1.1 选择verdaccio的理由"></a>1.1 选择verdaccio的理由</h2><ul>
<li>verdaccio是nodejs 创建的轻量的私有npm proxy registry，froked于<a href="mailto:&#115;&#x69;&#110;&#x6f;&#x70;&#105;&#97;&#x40;&#x31;&#x2e;&#52;&#46;&#x30;">&#115;&#x69;&#110;&#x6f;&#x70;&#105;&#97;&#x40;&#x31;&#x2e;&#52;&#46;&#x30;</a> ,是一个开源的npm私有库的搭建工具，可以搭建一套属于自己公司的npm仓库。<ul>
<li>与yarn 、npm 和pnmp  100%兼容</li>
<li>提供的Docker和Kubernetes支持，很容易安装和使用</li>
<li>发布的包是私有和配置访问权限</li>
<li>verdaccio是需要缓存所有相关项，并且在本地或者私有网络下可以加速安装</li>
</ul>
</li>
</ul>
<h1 id="2-搭建过程"><a href="#2-搭建过程" class="headerlink" title="2.搭建过程"></a>2.搭建过程</h1><ul>
<li>下载之前保证您的node版本&gt;v8.x npm版本&gt;v5.x yarn&gt;v1.x pnpm&gt;v2.x ，web应用支持浏览器Chrome，Firefox，Edge和IE11以上</li>
<li>verdaccio安装<figure class="highlight awk"><i class="iconfont icon-top" type="button" data-toggle="collapse" data-target="#collapse-2imz5dlacl5vpe"></i><span>awk</span><div class="collapse show" id="collapse-2imz5dlacl5vpe"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><code class="hljs awk"><span class="hljs-regexp">//</span>在cmd输入<br>npm install -g verdaccio  <span class="hljs-regexp">//</span>npm下载<br><br>yarn global add verdaccio  <span class="hljs-regexp">//y</span>arn下载  用yarn下载的时候 verdaccio运行不起来的时候请换成npm下载<br><br><span class="hljs-regexp">//</span>或者nrm切换下源地址  要是报权限错误的话，请选择cmd&lt;以管理员身份运行&gt;在输入一次<br><span class="hljs-regexp">//</span>或者在cmd输入下面的命令：<br>npm install -g verdaccio --unsafe-perm  <br><span class="hljs-regexp">//</span>--unsafe-perm添加上是为了防止报 gyp ERR! permission denied 的权限问题<br><br><span class="hljs-regexp">//</span>下载完成后会有红色字体表示：表示没有python的环境，这个时候不需要理会。<br><br><span class="hljs-regexp">//</span>在cmd输入：verdaccio 执行效果如下：<br></code></pre></td></tr></table></div></figure>
<img src="https://ikkiss.oss-cn-hangzhou.aliyuncs.com/images/npm/ikki-2022-04-14-11-10-49.png" srcset="https://ikkiss.oss-cn-hangzhou.aliyuncs.com/images/myblog/loading.gif" lazyload></li>
<li>默认端口号是4873，在谷歌浏览器显示页面是：<br><img src="https://ikkiss.oss-cn-hangzhou.aliyuncs.com/images/npm/ikki-2022-04-14-11-13-34.png" srcset="https://ikkiss.oss-cn-hangzhou.aliyuncs.com/images/myblog/loading.gif" lazyload></li>
<li>出现这个页面就说明您下载成功啦！<h1 id="3-配置信息"><a href="#3-配置信息" class="headerlink" title="3.配置信息"></a>3.配置信息</h1></li>
<li>在上面的图片可以得到verdaccio文件的配置文件地址是/Users/adminx/.config/verdaccio ，可以看到文件如图所示：<br><img src="https://ikkiss.oss-cn-hangzhou.aliyuncs.com/images/npm/ikki-2022-04-14-11-14-49.png" srcset="https://ikkiss.oss-cn-hangzhou.aliyuncs.com/images/myblog/loading.gif" lazyload></li>
<li>默认启动服务需要占用4873端口，若启动verdaccio服务失败请检查该端口是否被占用，或者手动修改对应的配置文件。配置文件在上图能找出，修改其端口号。</li>
<li>config.yaml文件配置信息：<a target="_blank" rel="noopener" href="https://verdaccio.org/docs/en/configuration">https://verdaccio.org/docs/en/configuration</a><figure class="highlight yaml"><i class="iconfont icon-top" type="button" data-toggle="collapse" data-target="#collapse-5491ujlacl5vpe"></i><span>yaml</span><div class="collapse show" id="collapse-5491ujlacl5vpe"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br></pre></td><td class="code"><pre><code class="hljs yaml"><span class="hljs-comment">#</span><br><span class="hljs-comment"># 这是默认的配置文件. 它会允许我们做任何事情,</span><br><span class="hljs-comment"># 所以不要在生产环境(系统)使用它.</span><br><span class="hljs-comment">#</span><br><span class="hljs-comment"># 在这里可以看见更多的配置示例:</span><br><span class="hljs-comment"># https://github.com/verdaccio/verdaccio/tree/master/conf</span><br><span class="hljs-comment">#</span><br><br><span class="hljs-comment"># 包含所有包的目录路径,npm私服包的存放目录以及缓存地址</span><br><span class="hljs-attr">storage:</span> <span class="hljs-string">./storage</span><br><span class="hljs-comment"># 包含plugins的目录路径,默认插件的文件位置，一般只对docker部署有关系</span><br><span class="hljs-attr">plugins:</span> <span class="hljs-string">./plugins</span><br><br><span class="hljs-attr">web:</span>  <span class="hljs-comment">#verdaccio的界面</span><br>  <span class="hljs-attr">title:</span> <span class="hljs-string">Verdaccio</span><br>  <span class="hljs-comment"># comment out to disable gravatar support 注释掉gravatar禁止使用</span><br>  <span class="hljs-comment"># gravatar: false</span><br>  <span class="hljs-comment"># by default packages are ordercer ascendant (asc|desc)  默认的packages是准备好的两个选择</span><br>  <span class="hljs-comment"># sort_packages: asc</span><br>  <span class="hljs-comment"># convert your UI to the dark side  用户界面是黑夜模式</span><br>  <span class="hljs-comment"># darkMode: true</span><br><br><span class="hljs-comment"># translate your registry, api i18n not available yet  看看下你的注册表，i18n api还不能使用</span><br><span class="hljs-comment"># i18n:</span><br><span class="hljs-comment"># list of the available translations 查看可以使用的注册列表的地址：https://github.com/verdaccio/ui/tree/master/i18n/translations</span><br><span class="hljs-comment">#   web: en-US</span><br><br><span class="hljs-attr">auth:</span>  <br>  <span class="hljs-attr">htpasswd:</span><br>    <span class="hljs-attr">file:</span> <span class="hljs-string">./htpasswd</span>  <span class="hljs-comment">#保存用户的账号信息比如用户名，密码等，还没有注册或者登录的话暂时看不到</span><br>    <span class="hljs-comment"># Maximum amount of users allowed to register, defaults to &quot;+inf&quot;.允许注册的最大用户数量，可以是无穷大</span><br>    <span class="hljs-comment"># You can set this to -1 to disable registration. 你可以设置-1去禁止用户通过 npm adduser 去注册</span><br>    <span class="hljs-comment"># max_users: 1000  #默认注册人数最大数量是1000</span><br><br><span class="hljs-comment"># a list of other known repositories we can talk to  我们需要了解其他相关有名的存储库</span><br><span class="hljs-attr">uplinks:</span> <span class="hljs-comment">#配置上游的npm服务器，主要用于请求的库不存在时可以去到上游服务器去获取，可以多配置下上游链路的链接</span><br>  <span class="hljs-attr">npmjs:</span><br>    <span class="hljs-attr">url:</span> <span class="hljs-string">https://registry.npmjs.org/</span><br>    <span class="hljs-attr">agent_options:</span>  <span class="hljs-comment">#代理的配置项</span><br>      <span class="hljs-attr">keepAlive:</span> <span class="hljs-literal">true</span> <br>      <span class="hljs-attr">maxSockets:</span> <span class="hljs-number">40</span><br>      <span class="hljs-attr">maxFreeSockets:</span> <span class="hljs-number">10</span><br><br><span class="hljs-attr">packages:</span> <span class="hljs-comment"># 配置模块,access访问下载权限，pushlish包的发布权限</span><br>  <span class="hljs-string">&#x27;@*/*&#x27;</span><span class="hljs-string">:</span> <span class="hljs-comment"># 一种是@/表示某下面所属的某项目,关键字匹配</span><br>    <span class="hljs-comment"># scoped packages   配置权限管理</span><br>    <span class="hljs-attr">access:</span> <span class="hljs-string">$all</span> <span class="hljs-comment"># 表示哪一类用户可以对匹配的项目进行安装(install)和查看包的信息</span><br>    <span class="hljs-attr">publish:</span> <span class="hljs-string">$authenticated</span> <span class="hljs-comment"># 表示哪一类用户可以对匹配的项目进行发布(publish)</span><br>    <span class="hljs-attr">unpublish:</span> <span class="hljs-string">$authenticated</span> <span class="hljs-comment"># 表示哪一类用户可以对匹配的项目进行卸载(publish)</span><br>    <span class="hljs-attr">proxy:</span> <span class="hljs-string">npmjs</span> <span class="hljs-comment"># 这里的值是对应于 uplinks 的名称，如果本地不存在，允许去对应的uplinks去拉取</span><br><br>  <span class="hljs-string">&#x27;**&#x27;</span><span class="hljs-string">:</span> <span class="hljs-comment"># 另一种是*匹配项目名称(名称在package.json中有定义)</span><br>    <span class="hljs-comment"># allow all users (including non-authenticated users) to read and</span><br>    <span class="hljs-comment"># publish all packages</span><br>    <span class="hljs-comment"># 允许所有用户（包括未经身份验证的用户）读取和发布所有包</span><br>    <span class="hljs-comment"># you can specify usernames/groupnames (depending on your auth plugin) 您可以指定用户名/组织名称（取决于验证身份的插件）</span><br>    <span class="hljs-comment"># and three keywords: &quot;$all&quot;, &quot;$anonymous&quot;, &quot;$authenticated&quot; 三个关键字:所有的,匿名的,验证过的  也可以使用具体的用户名或者组织名称(公司私有的名字)和配置的用户表 htpasswd 有关</span><br>    <span class="hljs-attr">access:</span> <span class="hljs-string">$all</span><br><br>    <span class="hljs-comment"># allow all known users to publish/publish packages 允许所有用户去发布包</span><br>    <span class="hljs-comment"># (anyone can register by default, remember?)  任何人都可以默认注册</span><br>    <span class="hljs-attr">publish:</span> <span class="hljs-string">$authenticated</span><br>    <span class="hljs-attr">unpublish:</span> <span class="hljs-string">$authenticated</span><br><br>    <span class="hljs-comment"># if package is not available locally, proxy requests to &#x27;npmjs&#x27; registry 如果包不允许在本机使用，可以用proxy请求npmjs注册表的代理</span><br>    <span class="hljs-attr">proxy:</span> <span class="hljs-string">npmjs</span><br><br><span class="hljs-comment"># You can specify HTTP/1.1 server keep alive timeout in seconds for incoming connections. 传入的指定连接的HTTP/1.1服务器保持活跃状态直到超时，以秒为单位</span><br><span class="hljs-comment"># A value of 0 makes the http server behave similarly to Node.js versions prior to 8.0.0, which did not have a keep-alive timeout.  值为0的时候的服务表现行为和8.0.0之前版本的nodejs链接的时候没有保持活跃状态导致超时</span><br><span class="hljs-comment"># WORKAROUND: Through given configuration you can workaround following issue  解决办法：通过已知的配置，你可以解决这些问题: https://github.com/verdaccio/verdaccio/issues/301. Set to 0 in case 60 is not enough.  如果60不够的话可以设置为0</span><br><span class="hljs-attr">server:</span><br>  <span class="hljs-attr">keepAliveTimeout:</span> <span class="hljs-number">60</span> <br><br><span class="hljs-attr">middlewares:</span><br>  <span class="hljs-attr">audit:</span><br>    <span class="hljs-attr">enabled:</span> <span class="hljs-literal">true</span><br><br><span class="hljs-comment"># log settings  设置日志</span><br><span class="hljs-attr">logs:</span><br>  <span class="hljs-bullet">-</span> &#123; <span class="hljs-attr">type:</span> <span class="hljs-string">stdout</span>, <span class="hljs-attr">format:</span> <span class="hljs-string">pretty</span>, <span class="hljs-attr">level:</span> <span class="hljs-string">http</span> &#125;<br>  <span class="hljs-comment">#- &#123;type: file, path: verdaccio.log, level: info&#125;</span><br><span class="hljs-comment">#experiments: 实验性的</span><br><span class="hljs-comment">#  # support for npm token command  支持npm的token令牌</span><br><span class="hljs-comment">#  token: false</span><br><span class="hljs-comment">#  # support for the new v1 search endpoint, functional by incomplete read more on ticket 1732</span><br><span class="hljs-comment">#  search: false</span><br><span class="hljs-comment">#  # disable writing body size to logs, read more on ticket 1912</span><br><span class="hljs-comment">#  bytesin_off: false</span><br><br><span class="hljs-comment"># This affect the web and api (not developed yet) 这些会影响web和api(尚未开发的功能)</span><br><span class="hljs-comment">#i18n:</span><br><span class="hljs-comment">#web: en-US</span><br><br><span class="hljs-comment">#默认是没有的，只能在本机访问，添加后可以通过外网访问</span><br><span class="hljs-string">listen:0.0.0.0:4873</span><br></code></pre></td></tr></table></div></figure>
<h1 id="4-通过pm2启动verdaccio"><a href="#4-通过pm2启动verdaccio" class="headerlink" title="4.通过pm2启动verdaccio"></a>4.通过pm2启动verdaccio</h1><figure class="highlight awk"><i class="iconfont icon-top" type="button" data-toggle="collapse" data-target="#collapse-z8njl7lacl5vpe"></i><span>awk</span><div class="collapse show" id="collapse-z8njl7lacl5vpe"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><code class="hljs awk">npm install -g pm2 <span class="hljs-regexp">//</span>安装pm2<br><br>pm2 start verdaccio <span class="hljs-regexp">//</span>启动verdaccio  status为online即为成功 如下图所示：<br></code></pre></td></tr></table></div></figure>
<img src="https://ikkiss.oss-cn-hangzhou.aliyuncs.com/images/npm/ikki-2022-04-14-11-15-55.png" srcset="https://ikkiss.oss-cn-hangzhou.aliyuncs.com/images/myblog/loading.gif" lazyload></li>
<li>pm2  常见的执行命令：<figure class="highlight awk"><i class="iconfont icon-top" type="button" data-toggle="collapse" data-target="#collapse-5bz60ilacl5vpe"></i><span>awk</span><div class="collapse show" id="collapse-5bz60ilacl5vpe"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><code class="hljs awk"> npm install pm2 -g     <span class="hljs-regexp">//</span> 命令行安装 pm2<br> pm2 start app.js       <span class="hljs-regexp">//</span> 启动app.js应用程序<br> pm2 start app.js -i <span class="hljs-number">4</span>  <span class="hljs-regexp">//</span> 后台运行pm2，启动<span class="hljs-number">4</span>个app.js<br>                        <span class="hljs-regexp">//</span> 也可以把<span class="hljs-string">&#x27;max&#x27;</span> 参数传递给 star<br>                        <span class="hljs-regexp">//</span> 正确的进程数目依赖于Cpu的核心数目<br><br>pm2 start app.js  --watch      <span class="hljs-regexp">//</span> 当文件变化时自动重启应用<br>pm2 list                       <span class="hljs-regexp">//</span> 列表 PM2 启动的所有的应用程序<br>pm2 monit                      <span class="hljs-regexp">//</span> 显示每个应用程序的CPU和内存占用情况<br>pm2 logs                       <span class="hljs-regexp">//</span> 显示所有进程日志<br>pm2 start app.js --name=<span class="hljs-string">&quot;api&quot;</span>  <span class="hljs-regexp">//</span> 启动应用程序并命名为 <span class="hljs-string">&quot;api&quot;</span><br>pm2 start script.sh            <span class="hljs-regexp">//</span> 启动 bash 脚本<br>pm2 show [app-name]            <span class="hljs-regexp">//</span> 显示应用程序的所有信息<br>pm2 logs [app-name]            <span class="hljs-regexp">//</span> 显示指定应用程序的日志<br>pm2 stop all                   <span class="hljs-regexp">//</span> 停止所有的应用程序<br>pm2 stop <span class="hljs-number">0</span>                     <span class="hljs-regexp">//</span> 停止 id为 <span class="hljs-number">0</span>的指定应用程序<br>pm2 restart all                <span class="hljs-regexp">//</span> 重启所有应用<br>pm2 restart <span class="hljs-number">0</span>                  <span class="hljs-regexp">//</span> 重启指定的进程<br>pm2 <span class="hljs-keyword">delete</span> all                 <span class="hljs-regexp">//</span> 关闭并删除所有应用<br>pm2 <span class="hljs-keyword">delete</span> <span class="hljs-number">0</span>                   <span class="hljs-regexp">//</span> 删除指定应用程序id为<span class="hljs-number">0</span>的<br></code></pre></td></tr></table></div></figure>
<h1 id="5-npm包的流程"><a href="#5-npm包的流程" class="headerlink" title="5. npm包的流程"></a>5. npm包的流程</h1></li>
<li>新建一个文件夹名称为02.npm-test ，在cmd控制台上输入<figure class="highlight stata"><i class="iconfont icon-top" type="button" data-toggle="collapse" data-target="#collapse-lgr0lvlacl5vpe"></i><span>stata</span><div class="collapse show" id="collapse-lgr0lvlacl5vpe"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><code class="hljs stata"><span class="hljs-keyword">cd</span> 02.npm-<span class="hljs-keyword">test</span>  <br>npm init        <span class="hljs-comment">//初始化   默认指向index.js文件，所以新建一个index.js文件</span><br></code></pre></td></tr></table></div></figure>
<figure class="highlight fortran"><i class="iconfont icon-top" type="button" data-toggle="collapse" data-target="#collapse-0fpzbvlacl5vpe"></i><span>fortran</span><div class="collapse show" id="collapse-0fpzbvlacl5vpe"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><code class="hljs fortran">//<span class="hljs-built_in">index</span>.js<br><span class="hljs-keyword">module</span>.exports.Say = <span class="hljs-function"><span class="hljs-keyword">function</span><span class="hljs-params">(name)</span></span>&#123;<br>    <span class="hljs-keyword">return</span>  (<span class="hljs-string">&quot;Hello &quot;</span> + <span class="hljs-keyword">name</span>);<br>&#125;<br></code></pre></td></tr></table></div></figure></li>
<li>简单写完之后可以发布包啦！前提是cmd输入verdaccio  命令执行才可以的。<figure class="highlight awk"><i class="iconfont icon-top" type="button" data-toggle="collapse" data-target="#collapse-urbq25lacl5vpe"></i><span>awk</span><div class="collapse show" id="collapse-urbq25lacl5vpe"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><code class="hljs awk">npm adduser --registry http:<span class="hljs-regexp">//</span>localhost:<span class="hljs-number">4873</span>  <span class="hljs-regexp">//</span>添加功能，无账号的添加完毕直接包<br>npm login --registry=http:<span class="hljs-regexp">//</span>localhost:<span class="hljs-number">4873</span>        <span class="hljs-regexp">//</span>登录功能，有账号的话可以直接使用这个<br>npm publish --registry http:<span class="hljs-regexp">//</span>localhost:<span class="hljs-number">4873</span> <span class="hljs-regexp">//</span>发布包<br></code></pre></td></tr></table></div></figure></li>
<li>输入自己的用户名，密码，邮箱地址，成功结果如图所示。<br><img src="https://ikkiss.oss-cn-hangzhou.aliyuncs.com/images/npm/ikki-2022-04-14-11-18-54.png" srcset="https://ikkiss.oss-cn-hangzhou.aliyuncs.com/images/myblog/loading.gif" lazyload><br><img src="https://ikkiss.oss-cn-hangzhou.aliyuncs.com/images/npm/ikki-2022-04-14-11-19-22.png" srcset="https://ikkiss.oss-cn-hangzhou.aliyuncs.com/images/myblog/loading.gif" lazyload></li>
</ul>
<ul>
<li>发布成功如上图所示。小小提示下可以使用nrm进行管理npm源，来避免手动输入registry<figure class="highlight awk"><i class="iconfont icon-top" type="button" data-toggle="collapse" data-target="#collapse-fgkh3clacl5vpe"></i><span>awk</span><div class="collapse show" id="collapse-fgkh3clacl5vpe"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><code class="hljs awk">nrm add company http:<span class="hljs-regexp">//</span>localhost:<span class="hljs-number">4873</span>  <span class="hljs-regexp">//</span>company可以换任意名称  url地址  添加功能<br>nrm use company       <span class="hljs-regexp">//</span>使用company的源地址<br><br><span class="hljs-regexp">//</span>这样的话简单了结，不用手动输入registry<br>npm addUser  <br>npm login<br>npm publish<br><br><span class="hljs-regexp">//</span>注意：registry要切换到公司私有服务器地址，如果不是用nrm管理切换，则需要带上私有registry(重复啦!)<br></code></pre></td></tr></table></div></figure></li>
<li>此时在<a target="_blank" rel="noopener" href="http://localhost:4873/">http://localhost:4873/</a> 页面上进行更新，就会发现你发布的包(包的名称就是文件的名称)。<br><img src="https://ikkiss.oss-cn-hangzhou.aliyuncs.com/images/npm/ikki-2022-04-14-11-24-25.png" srcset="https://ikkiss.oss-cn-hangzhou.aliyuncs.com/images/myblog/loading.gif" lazyload></li>
<li>接下来呢，我们来下载刚刚发布的包<figure class="highlight awk"><i class="iconfont icon-top" type="button" data-toggle="collapse" data-target="#collapse-98ihmylacl5vpe"></i><span>awk</span><div class="collapse show" id="collapse-98ihmylacl5vpe"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><code class="hljs awk"><span class="hljs-regexp">//</span>注意：registry要切换到公司私有服务器地址，如果不是用nrm管理切换，则需要带上私有registry(再来一遍)<br><span class="hljs-regexp">//</span>新建一个文件夹名为  app<br>cd app<br>npm install <span class="hljs-number">02</span>.npm-test  <span class="hljs-regexp">//</span>要是没有切换的话，请手动添加 --registry=http:<span class="hljs-regexp">//</span>localhost:<span class="hljs-number">4873</span><br></code></pre></td></tr></table></div></figure></li>
<li>删除发布的包<figure class="highlight awk"><i class="iconfont icon-top" type="button" data-toggle="collapse" data-target="#collapse-wxw5eplacl5vpe"></i><span>awk</span><div class="collapse show" id="collapse-wxw5eplacl5vpe"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs awk">npm unpublish <span class="hljs-number">02</span>.npm-test --force  <span class="hljs-regexp">//</span>要是没有切换的话，请手动添加 --registry=http:<span class="hljs-regexp">//</span>localhost:<span class="hljs-number">4873</span><br></code></pre></td></tr></table></div></figure></li>
</ul>
<h1 id="6-权限"><a href="#6-权限" class="headerlink" title="6.权限"></a>6.权限</h1><ul>
<li>因为verdaccio默认是人人都可以注册的，所以需要先将注册窗口关闭<figure class="highlight awk"><i class="iconfont icon-top" type="button" data-toggle="collapse" data-target="#collapse-9co7i7lacl5vpe"></i><span>awk</span><div class="collapse show" id="collapse-9co7i7lacl5vpe"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><code class="hljs awk"><span class="hljs-regexp">//</span> <span class="hljs-regexp">/Users/</span>adminx<span class="hljs-regexp">/.config/</span>verdaccio/config.yaml<br>auth:<br>  htpasswd:<br>    file: ./htpasswd<br>    <span class="hljs-regexp">//</span> 此配置项可以关闭注册功能<br>    max_users: -<span class="hljs-number">1</span><br></code></pre></td></tr></table></div></figure></li>
<li>verdaccio 的认证是基于 verdaccio-htpasswd， 可以通过<a target="_blank" rel="noopener" href="https://hostingcanada.org/htpasswd-generator/">官方提供的工具</a>来生成 ，将生成的段字符串添加到 htpasswd 中即可，这样的话就可以登录npm私有库<br><img src="https://ikkiss.oss-cn-hangzhou.aliyuncs.com/images/npm/ikki-2022-04-14-11-29-54.png" srcset="https://ikkiss.oss-cn-hangzhou.aliyuncs.com/images/myblog/loading.gif" lazyload></li>
<li>之后就需要修改verdaccio文件下的config.yaml的配置：针对不同的包来设置access，publish，unpublish对应的权限组，因为htpasswd是默认的鉴权插件，所以只能写入相应的用户名，all，authenticated，$anonymous<figure class="highlight nestedtext"><i class="iconfont icon-top" type="button" data-toggle="collapse" data-target="#collapse-s0oob7lacl5vpe"></i><span>nestedtext</span><div class="collapse show" id="collapse-s0oob7lacl5vpe"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br></pre></td><td class="code"><pre><code class="hljs nestedtext"><span class="hljs-attribute">//小小实例下：</span><br><span class="hljs-attribute">auth</span><span class="hljs-punctuation">:</span><br>  <span class="hljs-attribute">htpasswd</span><span class="hljs-punctuation">:</span><br>    <span class="hljs-attribute">file</span><span class="hljs-punctuation">:</span> <span class="hljs-string">./htpasswd</span><br>    <span class="hljs-attribute">// 此配置项可以关闭注册功能</span><br><span class="hljs-attribute">    max_users</span><span class="hljs-punctuation">:</span> <span class="hljs-string">-1 </span><br>    <span class="hljs-attribute">duGroup</span><span class="hljs-punctuation">:</span><br>    <span class="hljs-attribute">// 这里可以自定义用户组</span><br><span class="hljs-attribute">    demoPublish</span><span class="hljs-punctuation">:</span> <span class="hljs-string">[xiaoming, xiaohong, xiaoli]</span><br>    <span class="hljs-attribute">demoUnpublish</span><span class="hljs-punctuation">:</span> <span class="hljs-string">[xiaojun, xiaoming]</span><br>    <span class="hljs-attribute">testPublish</span><span class="hljs-punctuation">:</span> <span class="hljs-string">[xiaoming,xiaojun]</span><br><br> <span class="hljs-attribute">packages</span><span class="hljs-punctuation">:</span><br>        <span class="hljs-attribute">&#x27;@demo/*&#x27;</span><span class="hljs-punctuation">:</span><br>            <span class="hljs-attribute">access</span><span class="hljs-punctuation">:</span> <span class="hljs-string">$all</span><br>        <span class="hljs-attribute">// 针对不同的包，可以指定不同的用户组来满足权限控制</span><br><span class="hljs-attribute">            publish</span><span class="hljs-punctuation">:</span> <span class="hljs-string">demoPublish</span><br>            <span class="hljs-attribute">unpublish</span><span class="hljs-punctuation">:</span> <span class="hljs-string">demoUnpublish</span><br>            <span class="hljs-attribute">proxy</span><span class="hljs-punctuation">:</span> <span class="hljs-string">npmjs</span><br>     <span class="hljs-attribute">&#x27;test&#x27;</span><span class="hljs-punctuation">: </span><br>            <span class="hljs-attribute">access</span><span class="hljs-punctuation">:</span> <span class="hljs-string">$all</span><br>            <span class="hljs-attribute">publish</span><span class="hljs-punctuation">:</span> <span class="hljs-string">testPublish</span><br>            <span class="hljs-attribute">unpublish</span><span class="hljs-punctuation">:</span> <span class="hljs-string">demoUnpublish</span><br>            <span class="hljs-attribute">proxy</span><span class="hljs-punctuation">:</span> <span class="hljs-string">npmjs</span><br></code></pre></td></tr></table></div></figure></li>
<li>或者通过安装htpasswd-for-sinopia工具来添加账号<figure class="highlight awk"><i class="iconfont icon-top" type="button" data-toggle="collapse" data-target="#collapse-zc04f7lacl5vpe"></i><span>awk</span><div class="collapse show" id="collapse-zc04f7lacl5vpe"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><code class="hljs awk">npm install htpasswd-<span class="hljs-keyword">for</span>-sinopia -g<br><br>sinopia-adduser   <span class="hljs-regexp">//</span> 在 htpasswd 目录执行<br></code></pre></td></tr></table></div></figure></li>
<li>为其他登录的用户生成用户名和密码，之后将用户名和密码写入verdaccio文件夹下的htpasswd文件中，然后就跟上文是一样的步骤。</li>
</ul>

                
              </div>
            
            <hr/>
            <div>
              <div class="post-metas my-3">
  
    <div class="post-meta mr-3 d-flex align-items-center">
      <i class="iconfont icon-category"></i>
      

<span class="category-chains">
  
  
    
      <span class="category-chain">
        
  <a href="/categories/%E5%89%8D%E7%AB%AF%E5%B7%A5%E7%A8%8B%E5%8C%96/" class="category-chain-item">前端工程化</a>
  
  
    <span>></span>
    
  <a href="/categories/%E5%89%8D%E7%AB%AF%E5%B7%A5%E7%A8%8B%E5%8C%96/npm/" class="category-chain-item">npm</a>
  
  

  

      </span>
    
  
</span>

    </div>
  
  
    <div class="post-meta">
      <i class="iconfont icon-tags"></i>
      
        <a href="/tags/%E5%89%8D%E7%AB%AF%E5%B7%A5%E7%A8%8B%E5%8C%96/">#前端工程化</a>
      
        <a href="/tags/npm/">#npm</a>
      
    </div>
  
</div>


              
  

  <div class="license-box my-3">
    <div class="license-title">
      <div>npm私有库</div>
      <div>http://81.68.132.127/2022/09/22/npm/npm私有库/</div>
    </div>
    <div class="license-meta">
      
        <div class="license-meta-item">
          <div>作者</div>
          <div>Ikki</div>
        </div>
      
      
        <div class="license-meta-item license-meta-date">
          <div>发布于</div>
          <div>2022年9月22日</div>
        </div>
      
      
        <div class="license-meta-item license-meta-date">
          <div>更新于</div>
          <div>2022年10月7日</div>
        </div>
      
      
        <div class="license-meta-item">
          <div>许可协议</div>
          <div>
            
              
              
                <a target="_blank" href="https://creativecommons.org/licenses/by/4.0/">
                  <span class="hint--top hint--rounded" aria-label="BY - 署名">
                    <i class="iconfont icon-by"></i>
                  </span>
                </a>
              
            
          </div>
        </div>
      
    </div>
    <div class="license-icon iconfont"></div>
  </div>



              
                <div class="post-prevnext my-3">
                  <article class="post-prev col-6">
                    
                    
                      <a href="/2022/09/22/npm/package-json%E4%B8%8Epackage-lock-json%E7%9A%84%E5%85%B3%E7%B3%BB/" title="package.json与package-lock.json的关系">
                        <i class="iconfont icon-arrowleft"></i>
                        <span class="hidden-mobile">package.json与package-lock.json的关系</span>
                        <span class="visible-mobile">上一篇</span>
                      </a>
                    
                  </article>
                  <article class="post-next col-6">
                    
                    
                      <a href="/2022/09/22/npm/npm%E5%8C%85%E5%8F%91%E5%B8%83/" title="npm包发布">
                        <span class="hidden-mobile">npm包发布</span>
                        <span class="visible-mobile">下一篇</span>
                        <i class="iconfont icon-arrowright"></i>
                      </a>
                    
                  </article>
                </div>
              
            </div>

            
  <article id="comments" lazyload>
    
  <div id="valine"></div>
  <script type="text/javascript">
    Fluid.utils.loadComments('#valine', function() {
      Fluid.utils.createScript('https://lib.baomitu.com/valine/1.5.1/Valine.min.js', function() {
        var options = Object.assign(
          {"appId":"6KzYWc2oaEBaHgNl4UIicMJC-gzGzoHsz","appKey":"vJ4FIwKeHRmHraCJraAsjyZ7","path":"window.location.pathname","placeholder":"请输入你的评论\n昵称为必填项目(输入QQ号码可以自动获取昵称和邮箱)\n虽然email不是必选，但是填写了email可以收到推送通知哦！","avatar":"retro","meta":["nick","mail","link"],"requiredFields":[],"pageSize":10,"lang":"zh-CN","highlight":true,"recordIP":true,"serverURLs":"","emojiCDN":null,"emojiMaps":null,"enableQQ":true},
          {
            el: "#valine",
            path: window.location.pathname
          }
        )
        new Valine(options);
        Fluid.utils.waitElementVisible('#valine .vcontent', () => {
          var imgSelector = '#valine .vcontent img:not(.vemoji)';
          Fluid.plugins.imageCaption(imgSelector);
          Fluid.plugins.fancyBox(imgSelector);
        })
      });
    });
  </script>
  <noscript>Please enable JavaScript to view the comments</noscript>


  </article>


          </article>
        </div>
      </div>
    </div>

    <div class="side-col d-none d-lg-block col-lg-2">
      

    </div>
  </div>
</div>





  



  



  



  



  







    

    
      <a id="scroll-top-button" aria-label="TOP" href="#" role="button">
        <i class="iconfont icon-arrowup" aria-hidden="true"></i>
      </a>
    

    
      <div class="modal fade" id="modalSearch" tabindex="-1" role="dialog" aria-labelledby="ModalLabel"
     aria-hidden="true">
  <div class="modal-dialog modal-dialog-scrollable modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header text-center">
        <h4 class="modal-title w-100 font-weight-bold">搜索</h4>
        <button type="button" id="local-search-close" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body mx-3">
        <div class="md-form mb-5">
          <input type="text" id="local-search-input" class="form-control validate">
          <label data-error="x" data-success="v" for="local-search-input">关键词</label>
        </div>
        <div class="list-group" id="local-search-result"></div>
      </div>
    </div>
  </div>
</div>

    

    
  </main>

  <footer>
    <div class="footer-inner">
  
    <div class="footer-content">
      IKKI-专业BUG开发
    </div>
  
  
    <div class="statistics">
  
  

  
    
      <span id="busuanzi_container_site_pv" style="display: none">
        总访问量 
        <span id="busuanzi_value_site_pv"></span>
         次
      </span>
    
    
      <span id="busuanzi_container_site_uv" style="display: none">
        总访客数 
        <span id="busuanzi_value_site_uv"></span>
         人
      </span>
    
    
  
</div>

  
  
  
</div>

  </footer>

  <!-- Scripts -->
  
  <script  src="https://lib.baomitu.com/nprogress/0.2.0/nprogress.min.js" ></script>
  <link  rel="stylesheet" href="https://lib.baomitu.com/nprogress/0.2.0/nprogress.min.css" />

  <script>
    NProgress.configure({"showSpinner":false,"trickleSpeed":100})
    NProgress.start()
    window.addEventListener('load', function() {
      NProgress.done();
    })
  </script>


<script  src="https://lib.baomitu.com/jquery/3.6.0/jquery.min.js" ></script>
<script  src="https://lib.baomitu.com/twitter-bootstrap/4.6.1/js/bootstrap.min.js" ></script>
<script  src="/js/events.js" ></script>
<script  src="/js/plugins.js" ></script>


  <script  src="https://lib.baomitu.com/typed.js/2.0.12/typed.min.js" ></script>
  <script>
    (function (window, document) {
      var typing = Fluid.plugins.typing;
      var subtitle = document.getElementById('subtitle');
      if (!subtitle || !typing) {
        return;
      }
      var text = subtitle.getAttribute('data-typed-text');
      
        typing(text);
      
    })(window, document);
  </script>




  
    <script  src="/js/img-lazyload.js" ></script>
  




  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/tocbot/4.18.2/tocbot.min.js', function() {
    var toc = jQuery('#toc');
    if (toc.length === 0 || !window.tocbot) { return; }
    var boardCtn = jQuery('#board-ctn');
    var boardTop = boardCtn.offset().top;

    window.tocbot.init(Object.assign({
      tocSelector     : '#toc-body',
      contentSelector : '.markdown-body',
      linkClass       : 'tocbot-link',
      activeLinkClass : 'tocbot-active-link',
      listClass       : 'tocbot-list',
      isCollapsedClass: 'tocbot-is-collapsed',
      collapsibleClass: 'tocbot-is-collapsible',
      scrollSmooth    : true,
      includeTitleTags: true,
      headingsOffset  : -boardTop,
    }, CONFIG.toc));
    if (toc.find('.toc-list-item').length > 0) {
      toc.css('visibility', 'visible');
    }

    Fluid.events.registerRefreshCallback(function() {
      if ('tocbot' in window) {
        tocbot.refresh();
        var toc = jQuery('#toc');
        if (toc.length === 0 || !tocbot) {
          return;
        }
        if (toc.find('.toc-list-item').length > 0) {
          toc.css('visibility', 'visible');
        }
      }
    });
  });
</script>


  <script src=https://lib.baomitu.com/clipboard.js/2.0.11/clipboard.min.js></script>

  <script>Fluid.plugins.codeWidget();</script>


  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/anchor-js/4.3.1/anchor.min.js', function() {
    window.anchors.options = {
      placement: CONFIG.anchorjs.placement,
      visible  : CONFIG.anchorjs.visible
    };
    if (CONFIG.anchorjs.icon) {
      window.anchors.options.icon = CONFIG.anchorjs.icon;
    }
    var el = (CONFIG.anchorjs.element || 'h1,h2,h3,h4,h5,h6').split(',');
    var res = [];
    for (var item of el) {
      res.push('.markdown-body > ' + item.trim());
    }
    if (CONFIG.anchorjs.placement === 'left') {
      window.anchors.options.class = 'anchorjs-link-left';
    }
    window.anchors.add(res.join(', '));

    Fluid.events.registerRefreshCallback(function() {
      if ('anchors' in window) {
        anchors.removeAll();
        var el = (CONFIG.anchorjs.element || 'h1,h2,h3,h4,h5,h6').split(',');
        var res = [];
        for (var item of el) {
          res.push('.markdown-body > ' + item.trim());
        }
        if (CONFIG.anchorjs.placement === 'left') {
          anchors.options.class = 'anchorjs-link-left';
        }
        anchors.add(res.join(', '));
      }
    });
  });
</script>


  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/fancybox/3.5.7/jquery.fancybox.min.js', function() {
    Fluid.plugins.fancyBox();
  });
</script>


  <script>Fluid.plugins.imageCaption();</script>

  <script  src="/js/local-search.js" ></script>

  <script defer src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js" ></script>




  
<script src="/fluid/js/star.js"></script>



<!-- 主题的启动项，将它保持在最底部 -->
<!-- the boot of the theme, keep it at the bottom -->
<script  src="/js/boot.js" ></script>


  

  <noscript>
    <div class="noscript-warning">博客在允许 JavaScript 运行的环境下浏览效果更佳</div>
  </noscript>
</body>
</html>
